package com.yf.entity;

import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class UserTree {

    //左编号
    protected Long treeLeft;
    //右编号
    protected Long treeRight;
    //层次
    protected Long treeLevel;

    //从上级获取本身节点
    public static UserTree getUserTree(Long treeRight, Long treeLevel){
        UserTree userTree = new UserTree();
        //新增节点的左节点是上级节点的右节点
        userTree.setTreeLeft(treeRight);
        //新增节点的右节点是上级节点的右节点+1
        userTree.setTreeRight(treeRight+1);
        //层级
        userTree.setTreeLevel(treeLevel+1);
        return userTree;
    }


}
